package game.view.test
{
	import fl.controls.listClasses.ImageCell;
	
	import flash.display.DisplayObject;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.events.MouseEvent;
	
	import game.define.NotificationNames;
	import game.define.typedef.MouseStyle;
	import game.manager.LayerManager;
	
	import org.puremvc.as3.patterns.facade.Facade;
	
	import utiles.MouseCursorHelper;
	import utiles.StageProxy;
	
	public class TestMediator
	{
		private var content:Array = 
		[
			{label:"舞台", notiname:1},
			{label:"缩小舞台", notiname:2},
		];
		
		private function xxx(key:*):void
		{
			var send:Function = Facade.getInstance().sendNotification;
			var i:int = 0;
			switch (key)
			{
				case 1:
					trace(StageProxy.root.scaleY + "1");
					StageProxy.root.scaleX += 0.3;
					StageProxy.root.scaleY += 0.3;
					StageProxy.root.scaleX = 1;
					StageProxy.root.scaleY = 1;
					trace(StageProxy.root.scaleY);
					break;
				case 2:
					StageProxy.root.scaleX -= 0.3;
					StageProxy.root.scaleY -= 0.3;
					StageProxy.root.x = StageProxy.width - StageProxy.root.width >> 1;
					StageProxy.root.y = StageProxy.height - StageProxy.root.height >> 1;
					break;
			}
		}
		
		
		private var rootBorder:Sprite;
		private function initRootBorder():void
		{
			rootBorder new Sprite();
			var line1:Shape = new Shape();
		}
		
		private function inits():void
		{
			
		}
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		////////////////////////////////////////////////////////////////////////////////////
		private static var _instance:TestMediator;
		public static function get instance():TestMediator
		{
			if (!_instance)
				_instance = new TestMediator();
			return _instance;
		}
		
		private var view:TestView = new TestView();
		
		public function TestMediator()
		{
			//
			view.container.addEventListener(MouseEvent.CLICK, onClick);
			
			//
			for (var i:int=0; i<content.length; i++)
				view.list.dataProvider.addItem(content[i]);
			
			inits();
		}
		
		protected function onClick(event:MouseEvent):void
		{
			if (event.target is ImageCell)
			{
				var imageCell:ImageCell = event.target as ImageCell;
				xxx(imageCell.data.notiname);
			}
			else
			{
				hide();
			}
		}
		
		public function show():void
		{
			LayerManager.windowsLayer.addChild(view);
			MouseCursorHelper.instance.show(null);
		}
		
		public function hide():void
		{
			if (LayerManager.windowsLayer.contains(view))
				LayerManager.windowsLayer.removeChild(view);
			MouseCursorHelper.instance.show(MouseStyle.DEFAULT);
		}
	}
}
import fl.controls.TileList;
import fl.data.DataProvider;

import flash.display.Sprite;

class TestView extends Sprite
{
	public var container:Sprite;
	public var list:TileList;
	
	public function TestView()
	{
		container = new Sprite();
		container.graphics.beginFill(0);
		container.graphics.drawRect(0,0, 560, 390);
		container.graphics.endFill();
		addChild(container);
		
		//
		list = new TileList();
		list.dataProvider = new DataProvider();
		list.rowHeight = 30;
		list.columnWidth = 80;
		list.rowCount = 13;
		list.columnCount = 7;
		container.addChild(list);
	}
}
	